<?php
namespace app\admin\controller;
use think\Controller;
use think\Session;

if (!Session::has('DSL','admin')){
    die('非法登录');
}

class Main extends Controller
{
    public function main_view(){
        $user_id = Session::get('user_id','admin');
        $login_url = url('admin/login/check_login','','');
        $modules = $this->show_modules($user_id);
        $this->assign('login_view',$login_url);
        $this->assign('modules',$modules);
        return $this->fetch('main');
    }
    
    protected function show_modules($user_id){
       $user_model = model('User');
       $modules = $user_model->getModules($user_id);
       return $modules;
    }
}
